package com.kylin.common.security.domain;

import com.alibaba.fastjson2.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * jwt存储信息对象
 * @author wuhao
 * @version 1.0 - 2023/1/10
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ClaimsInfo {

    /** 用户id */
    @JSONField(name = "user_id")
    private long userId;

    /** 用户类型 */
    @JSONField(name = "account_type")
    private String accountType;

    /**
     * 缓存token-key
     * login:账号类型:用户ID
     */
    public String getTokenKey() {
        return "login:" + accountType + ":" + userId;
    }
}
